import java.io.IOException;
import java.sql.SQLException;

public class Login {
    public String username = "bit" ;
    public String passWord = "123" ;


    public void loginInfo(String uername,String passWord) throws UerNameException,PassWordException{
        if (!this.username.equals(uername)) {
            //System.out.println("用户名有问题...");
            throw new UerNameException("用户名有问题，您输入的用户名是："+uername);
            //return;
        }

        if (!this.passWord.equals(passWord)) {
            //System.out.println("密码有问题...");
            throw new PassWordException("密码有问题，您输入的用户名是："+passWord);
            //return;
        }
        System.out.println("登陆成功! ");
    }

    public static void main(String[] args) {
        Login login=new Login();
        try{
            login.loginInfo("bit","1253");
        }catch(UerNameException e){
           e.printStackTrace();
            System.out.println("捕获了 UerNameException 异常");
        }catch (PassWordException e){
            e.printStackTrace();
            System.out.println("捕获了 PassWordException 异常");
        }
    }





    public static void func2(){
        try{
            int[] array = null;
            System.out.println(array.length);
        }catch(NullPointerException e){
            try{
                int[] array = {1,2,3};
                System.out.println(array[9]);
            }catch(ArrayIndexOutOfBoundsException e2){

            }
        }finally {
            System.out.println("hahaha");
        }
    }


    public static void main1(String[] args) {
        func2();

        try{

        }finally {

        }
    }
}
